Skip to content

docs: application canisters reference#86

Merged
marc0olo merged 2 commits into
mainfrom
docs/reference-application-canisters
Apr 16, 2026
Merged

docs: application canisters reference#86
marc0olo merged 2 commits into
mainfrom
docs/reference-application-canisters

Conversation

@marc0olo
Copy link
Copy Markdown
Member

Summary

  • Asset canister: icp.yaml recipe, Candid interface table, .ic-assets.json5 SPA configuration, programmatic upload with @icp-sdk/canisters
  • SNS canisters: six per-dapp governance canisters with method tables and CLI canister ID query
  • LLM canister: Rust and Motoko examples for single-turn prompt and multi-turn chat

Sync recommendation

informed by dfinity/examples — rust/llm_chatbot, motoko/llm_chatbot

@marc0olo
Copy link
Copy Markdown
Member Author

Review: Application Canisters

Must fix

  • list_sns_canisters is on the wrong canister: The page states (line 200-205) "call the list_sns_canisters method on the governance canister to retrieve the IDs of all canisters in the set". This is incorrect. According to .sources/portal/docs/building-apps/governing-apps/testing/testing-on-mainnet.mdx (line 162), list_sns_canisters is called on sns_root, not sns_governance. The CLI example should use <sns_root_id> not <sns_governance_id>, and the prose should say "call list_sns_canisters on the Root canister".

  • Local development JSON block uses dfx.json syntax, not icp.yaml syntax: The "Local development" section (lines 316-330) tells the developer to "add the LLM canister to your icp.yaml" and shows a JSON block with "type": "custom", "specified_id", and "remote" fields. These are dfx.json-specific fields — they do not exist in the icp-cli canister YAML schema (canister-yaml-schema.json has no specified_id or remote fields). This block is copied directly from .sources/examples/rust/llm_chatbot/dfx.json. The page must either (a) provide the correct icp.yaml-format snippet for icp-cli, or (b) if icp-cli does not yet have an equivalent mechanism, note that limitation clearly instead of presenting a non-functional JSON snippet labeled as icp.yaml content. Presenting dfx.json syntax as icp.yaml content will mislead developers.

Suggestions

  • JS snippet: fileBuffer is undeclared: The programmatic uploads example (lines 128-134) uses fileBuffer in assetManager.store(fileBuffer, {...}) without declaring or assigning it. The skill example uses readFileSync to obtain a buffer. Adding a brief comment such as // fileBuffer: Uint8Array | Buffer from fs.readFileSync, fetch, or File API would prevent developer confusion.

  • SNS section: ICRC-3 not mentioned: SNS ledgers also implement ICRC-3 (the transaction log standard). The ledger table only lists ICRC-1 and ICRC-2. Not critical for a reference overview, but worth a note since ICRC-3 is the standard way to query SNS transaction history.

  • Wasm versioning section is thin: The section lists only one key version (0.30.2). Linking to the full asset canister guide for the versioning context would help, since the reference page is not the right place for deployment pitfalls.

Verified

  • Frontmatter: Complete with title, description, and sidebar.order: 4. No contradictions between description and body.
  • Internal links: All linked pages exist. system-canisters.md, protocol-canisters.md, token-standards.md, guides/governance/launching.md, guides/frontends/asset-canister.md verified with ls. The guides/backends/onchain-ai.md link resolves to onchain-ai.mdx (Astro-compatible per project rules).
  • Asset canister recipe format: @dfinity/asset-canister@v2.1.0 verified against .sources/icp-cli/docs/guides/using-recipes.md and icp-cli-recipes.
  • Asset canister interface methods: All methods in the Permission management, Asset operations, Asset queries, and HTTP serving tables verified against .sources/portal/docs/references/asset-canister.mdx. No missing or fabricated methods.
  • .ic-assets.json5 example: security_policy, allow_raw_access, and enable_aliasing fields verified against .agents/skills/asset-canister/SKILL.md and portal reference.
  • JS programmatic upload API: AssetManager constructor, store(), list(), delete() verified against .sources/icp-js-sdk-docs/public/canisters/latest.zip. Import paths @icp-sdk/canisters/assets and @icp-sdk/core/agent confirmed correct.
  • HttpAgent.create() options: host and shouldFetchRootKey verified against HttpAgentOptions in core SDK docs. shouldFetchRootKey: false is correct for mainnet — SDK defaults to false, page is explicit about it.
  • Rust LLM code: Both snippets verified exactly against .sources/examples/rust/llm_chatbot/backend/lib.rs. Function signatures, model enum, and response.message.content.unwrap_or_default() are correct.
  • Motoko LLM code: Both snippets verified exactly against .sources/examples/motoko/llm_chatbot/backend/app.mo. LLM.chat().withMessages().send() and the switch pattern match are correct.
  • Library versions: ic-llm = "1.1.0" and ic-cdk = "0.17" verified against Cargo.toml. llm = "2.1.0" verified against mops.toml. All match pinned example versions.
  • LLM canister ID: w36hm-eqaaa-aaaal-qr76a-cai verified against both dfx.json files in llm_chatbot examples.
  • CLI syntax: icp canister call <canister> <method> '()' -e ic verified against .sources/icp-cli/docs/reference/cli.md.
  • No dfx references in prose: None found (the dfx.json-format JSON block issue is flagged separately above).
  • No mo:base imports: Motoko examples use mo:llm only.
  • Upstream comment: Present, references icskills, portal, and examples accurately.
  • Content rules: .md file, no inline JSX, code snippets under 30 lines, relative links use .md extension, no dfx commands in prose.
  • No TODO/verify flags: None present.
  • Page structure: Opens with clear category distinction (application vs system vs protocol). Each section: what it is → interface/config → further reading. Quick reference table and Next steps at end. Good funnel.

- Fix list_sns_canisters: called on Root canister, not Governance
- Remove dfx.json snippet from LLM local dev section; note icp-cli limitation
- Add fileBuffer type comment to JS programmatic upload example
- Add ICRC-3 to SNS ledger section and quick reference table
- Improve Wasm versioning link text to guide/asset-canister
@marc0olo
Copy link
Copy Markdown
Member Author

<!-- feedback-addressed -->

Feedback addressed — PR #86: Application Canisters reference

Changes applied

Must fix — list_sns_canisters on wrong canister (applied)

  • Changed prose from "call list_sns_canisters on the governance canister" to "call list_sns_canisters on the Root canister"
  • Changed CLI example from icp canister call <sns_governance_id> to icp canister call <sns_root_id>
  • Cross-checked against .sources/portal/docs/building-apps/governing-apps/testing/testing-on-mainnet.mdx line 162: dfx canister call sns_root list_sns_canisters '(record {})' — confirms Root canister is correct

Must fix — LLM local development section uses dfx.json syntax (applied)

  • Removed the JSON block that used "type": "custom", "specified_id", and "remote" fields — these are dfx.json-specific and do not exist in the icp-cli canister YAML schema (confirmed against .sources/icp-cli/docs/schemas/canister-yaml-schema.json)
  • Replaced with a note explaining that icp-cli does not yet have an equivalent mechanism, and directing developers to the dfinity/examples llm_chatbot repo for the dfx.json-based local setup

Suggestion — fileBuffer undeclared in JS snippet (applied)

  • Added a comment // fileBuffer: Uint8Array | ArrayBuffer | number[] — e.g. from fs.readFileSync, fetch, or the File API above the assetManager.store(fileBuffer, ...) call
  • Type information cross-checked against .sources/icp-js-sdk-docs/public/canisters/latest.zip StoreBytesArgs type definition

Suggestion — ICRC-3 not mentioned for SNS ledger (applied)

  • Updated SNS ledger section header from "implements ICRC-1 and ICRC-2" to "implements ICRC-1, ICRC-2, and ICRC-3"
  • Added icrc3_get_blocks row to the ledger methods table with description "Query transaction history (ICRC-3 transaction log)"
  • Updated quick reference table from "ICRC-1/ICRC-2 token ledger" to "ICRC-1/ICRC-2/ICRC-3 token ledger"

Suggestion — Wasm versioning section link text (applied)

  • Changed "For a full deployment guide, see Asset canister" to "For version history, upgrade guidance, and deployment pitfalls, see the Asset canister guide" — more descriptive of what the linked guide covers

Items skipped

None — all feedback items (both must-fix and suggestions) were factually correct and verified against source material.

Build note

The build fails due to a pre-existing issue in docs/guides/backends/https-outcalls.mdx (missing snippet file at .sources/examples/motoko/send_http_get/src/send_http_get_backend/main.mo — the examples submodule is not initialized in this worktree). This failure exists on both the pre-fix and post-fix versions of the branch and is unrelated to application-canisters.md.

@marc0olo marc0olo merged commit 7402eff into main Apr 16, 2026
1 check passed
@marc0olo marc0olo deleted the docs/reference-application-canisters branch April 16, 2026 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant